import {staticTplsV2} from "@/statics/arr";
import templates from './templates/index.js'

// console.log(fieldset)

let staticTpls = {
  sub() {
    /*
<template>
<dym-form :part-name="partName" v-if="inited" :debug="debug" :metas="formMetas" :config="formDef">

</dym-form>
</template>
<script>
const formName = ''
const formComName = 'dym-form-field__';
const formTemplate = '#[[TPL_ID]]';
const formDef = {type:'form',name:'form_xgUuxp',serviceTpl:{def:{},args:{src:'bservice.twig'}},def:{type:'object',ui:{},properties:{obj:{type:'object',properties:{field__NH3xb44Bwi:{type:'string',ui:{widget:'CusInput',label:'o.a',widgetConfig:{}},computedFun:'',rules:[],server:{field_name:'field__NH3xb44Bwi'},rules_json:'[]'},field__cRAQr_Xkiy:{type:'string',ui:{widget:'CusInput',label:'o.b',widgetConfig:{}},computedFun:'',rules:[],server:{field_name:'field__cRAQr_Xkiy'},rules_json:'[]'},field__MGN3rJ7_yA:{type:'string',ui:{widget:'CusInput',label:'结果',widgetConfig:{}},computedFun:"M(['obj','field__NH3xb44Bwi'])+M(['obj','field__cRAQr_Xkiy'])",rules:[],server:{field_name:'field__MGN3rJ7_yA'},rules_json:'[]'}},ui:{widgetConfig:{},defType:'obj'},server:{server_field:'obj'}},field__rX9_NqENUG:{type:'string',ui:{widget:'CusInput',label:'a',widgetConfig:{}},computedFun:'',rules:[],server:{field_name:'field__rX9_NqENUG'},rules_json:'[]'},field__byQAY9VX2T:{type:'string',ui:{widget:'CusInput',label:'b',widgetConfig:{}},computedFun:'',rules:[],server:{field_name:'field__byQAY9VX2T'},rules_json:'[]'},field__tkoNHUdCLs:{type:'string',ui:{widget:'CusInput',label:'a + b',widgetConfig:{}},computedFun:"M(['field__rX9_NqENUG'])+M(['field__byQAY9VX2T'])",rules:[],server:{field_name:'field__tkoNHUdCLs'},rules_json:'[]'}},metas:{}},computed:{}};
const formMetas =[[metas]];
let zformCommon = globalThis.createZformCommon({formDef, formComName, formMetas});
let def = {
    template: formTemplate,
    mixins: [
        zformCommon
    ]
}
globalThis[callback]({comName: formComName, def, comMetas: {formName}});
</script>
  */
  },
  /**
   * 自定义数组
   */
  cus_arr() {
    /*
<template>
<dym-form :part-name="partName" v-if="inited" :debug="false" :metas="formMetas" :config="formDef">

<template v-slot:object_beforebegin="scope">
<div     v-if='scope.level > 1' >测试</div>
</template>

<template v-slot:array_afterbegin="scope">

<template v-if="!zform__objGet(scope.config, 'ui.isCustomRender', false)">
<el-button @click="zform__appendArr(scope)">appendArr</el-button>
</template>

</template>

<template v-slot:array_con_beforeend="scope">
<el-button type="danger" @click="zform__deleteArr(scope)">delete</el-button>
</template>

</dym-form>
</template>
<script>
const formName = 'form-b'
const formComName = 'dym-form-field__form-b';
const formTemplate = '#[[TPL_ID]]';
const formDef = {type:'form',name:'form_ZpYZP_',serviceTpl:{def:{},args:{src:'bservice.twig'}},def:{type:'object',ui:{attrs:[['label-position','left']],class:[],styleSheets:[]},properties:{field__nyltuHFQ7N:{type:'string',ui:{widget:'CusInput',label:'属性1',widgetConfig:{}},computedFun:'',rules:[{required:true,message:'属性1必填👍'}],server:{field_name:'field__nyltuHFQ7N'},rules_json:"[{required:true,message:'属性1必填👍'}]"},loop__MWsNjo:{type:'array',items:{type:'object',properties:{field__X3VrmBzZ6h:{type:'string',ui:{widget:'CusInput',label:'单行文本',widgetConfig:{}},computedFun:'',rules:[{required:true}],server:{field_name:'field__X3VrmBzZ6h'},rules_json:'[{required:true}]'},field__Qgu9cl24zo:{type:'string',ui:{widget:'CusInput',label:'单行文本',widgetConfig:{}},server:{field_name:'field__Qgu9cl24zo'}},field__jN8ICur_7H:{type:'string',ui:{widget:'CusInput',label:'单行文本',widgetConfig:{}},server:{field_name:'field__jN8ICur_7H'}}}},ui:{widgetConfig:{},tag:'z-data-arr',defType:'arrayObj',isCustomRender:true},server:{field_name:'loop__MWsNjo'}}},metas:{form_data:{tableName:'json_6cea6',activeNo:'At202201213772',conifgNo:'At202201215382'}}},computed:{}};
const formMetas =[[metas]];
let zformCommon = globalThis.createZformCommon({formDef, formComName, formMetas});
let def = {
    template: formTemplate,
    mixins: [
        zformCommon
    ]
}
globalThis[callback]({comName: formComName, def, comMetas: {formName}});
</script>
  */
  },
  ...staticTplsV2
}

/**
 * 获取测试文件
 * @param staticFlg
 * @returns {(function())|*}
 */
export function getExampleVue(staticFlg = '') {
  let keys = Object.keys(staticTpls)
  if (keys.includes(staticFlg)) {
      return staticTpls[staticFlg]
  }
  if (templates[staticFlg]) {
    return templates[staticFlg]
  }
  return function () {/*
<template>
<dym-form  :part-name="partName" v-if="inited" :debug="debug" :metas="formMetas" :config="formDef">
  __AFTER_SRART__


<template v-slot:object_beforebegin="scope">
<div     v-if='scope.level > 1' >测试</div>
</template>


  __BEFORE_END__
</dym-form>
</template>
<script>
const formName = '测试a'
const formComName = 'dym-form-field__ce-shi-a';
const formTemplate = '#[[TPL_ID]]';
const formDef = {type:'form',name:'form_UlSeaV',serviceTpl:{def:{},args:{src:'bservice.twig'}},def:{type:'object',ui:{attrs:[['label-position','left']],class:[],styleSheets:[]},properties:{field__Z_QBV8U5as:{type:'string',ui:{widget:'CusInput',label:'单行文本',widgetConfig:{}},defaultVal:"{funcs:[['return `${VAL}<xy-text text-item level=\"${INDEX}\"  >1</xy-text>`']],textContent:'1'}",computedFun:'',rules:[],server:{field_name:'field__Z_QBV8U5as',events:"{events:[{UUID:'c9lUgXwlfnYTKiOo2hdhH',type:'change',action:'\"{funcs:[[\\'return `${VAL}<xy-text text-item level=\\\\\"${INDEX}\\\\\">ALERT(</xy-text>`\\'],[\\'return `${VAL}<xy-text text-item level=\\\\\"${INDEX}\\\\\"  >1</xy-text>`\\'],[\\'return `${VAL}<xy-text text-item level=\\\\\"${INDEX}\\\\\">)</xy-text>`\\']],textContent:\\'ALERT(1)\\'}\"'}]}"},rules_json:'[]'},field__TZ4fRcQJrZ:{type:'string',INIT_CONFIG:{type:'string'},ui:{widget:'CusInput',label:'多行文本',widgetConfig:{type:'textarea'}},computedFun:'',rules:[],server:{field_name:'field__TZ4fRcQJrZ'},rules_json:'[]'},field__RjlFs6ogfd:{type:'string',ui:{widget:'CusDateTimePicker',label:'日期选择器',widgetConfig:{type:'datetime',valueFormat:'YYYY-MM-DD HH:mm:ss'}},sub_type:'datetime',defaultVal:'2022-03-16 17:42:53',computedFun:'',rules:[],server:{field_name:'field__RjlFs6ogfd'},rules_json:'[]'},field__osnCYxhm6B:{type:'string',ui:{widget:'CusSelect',label:'选择(数据)',widgetConfig:{options2:"[{label:'选项1',value:'option1'},{label:'选项2',value:'option2'}]",source:"{data:{obj:{STATIC:{apis:{}},API:{apis:{'11':{params:[{name:'111'}]},'22':{params:[{name:'驱蚊器'}]},获取所有的人员:{origin:{id:'5d88832a11374caab9288e2a210e4ea1',deleteIf:true,remark:'0',createTime:'2022-03-09 11:10:00',createUser:'admin',updateTime:null,updateUser:'0',moudelType:'202200309002',moudelTypeName:null,interfaceName:'获取所有的人员',interfacePath:'/general/getSysUserList',interfaceMethods:'1',tokeIs:true,parameters:[{fieldName:'dictName',fieldValue:'String',value:'1111'}],option_label:'获取所有的人员',option_value:'获取所有的人员'},parameters:[{fieldName:'dictName',fieldValue:'String',value:'1111',fxValue:'\"{funcs:[[\\'return `${VAL}<xy-text text-item level=\\\\\"${INDEX}\\\\\"  >$G.userinfo.deptName</xy-text>`\\']],textContent:\\'$G.userinfo.deptName\\'}\"'}]},获取所有的部门:{parameters:[{fieldName:'departName',fieldValue:'String',value:'1111'}]}},name:'获取所有的人员'}},type:'API'}}"},source:"{data:{obj:{API:{apis:{获取所有的人员:{origin:{id:'5d88832a11374caab9288e2a210e4ea1',deleteIf:true,remark:'0',createTime:'2022-03-10 01:10:00',createUser:'admin',updateTime:null,updateUser:'0',moudelType:'202200309002',moudelTypeName:null,interfaceName:'获取所有的人员',interfacePath:'/general/getSysUserList',interfaceMethods:'1',tokeIs:true,parameters:[{fieldName:'dictName',fieldValue:'String',fxValue:'\"{funcs:[[\\'return `${VAL}<xy-text text-item level=\\\\\"${INDEX}\\\\\"  >$G.userinfo.deptName</xy-text>`\\']],textContent:\\'$G.userinfo.deptName\\'}\"'}],option_label:'获取所有的人员',option_value:'获取所有的人员'},parameters:[{fieldName:'dictName',fieldValue:'String',fxValue:\"'{funcs:[[\\\\'return `${VAL}<xy-text text-item level=\\\"${INDEX}\\\" val=\\\"$G.userinfo.deptName\\\" data-global-var >用户信息-部门名</xy-text>`\\\\']],textContent:\\\\'$G.userinfo.deptName\\\\'}'\"}]},test:{origin:{id:'251268c31f1d4186a14068fa22b98cac',deleteIf:true,remark:'0',createTime:'2022-03-21 11:04:12',createUser:'admin',updateTime:'2022-03-21 11:04:30',updateUser:'admin',moudelType:'202200309001',moudelTypeName:null,interfaceName:'test',interfacePath:'/test',interfaceMethods:'0',tokeIs:false,parameters:[{fieldName:'22',fieldValue:'22'},{fieldName:'1',fieldValue:'1'}],returnParameters:[{fieldName:'33',fieldValue:'33'}],option_label:'test',option_value:'test'},parameters:[{fieldName:'22',fieldValue:'22',fxValue:'\"{textContent:\\'\\'}\"'},{fieldName:'1',fieldValue:'1'}],returnUUID:'33',returnParameters:[{fieldName:'33',fieldValue:'33'}],returnValueUUID:'33'}},name:'test'}},type:'API'}}"},computedFun:'',rules:[],server:{field_name:'field__osnCYxhm6B'},rules_json:'[]'},field__yfTxTjyz9a:{type:'string',ui:{widget:'CusSelect',label:'选择(固定)',widgetConfig:{options2:"[{label:'选项1',value:'option1'},{label:'选项2',value:'option2'}]",source:"{data:{obj:{API:{apis:{}},STATIC:{value:\"[{label:' 1',value:' 1',UUID:''}]\",name:'11111'}},type:'STATIC'}}"},source:"{data:{obj:{STATIC:{value:\"[{label:' 1',value:' 1',UUID:''}]\",name:''}},type:'STATIC'}}"},computedFun:'',rules:[],server:{field_name:'field__yfTxTjyz9a'},rules_json:'[]'},field__oHoVJ0p5Z0:{type:'string',ui:{widget:'CusSelect',label:'选择(数据无参数)',widgetConfig:{options2:'[]'},source:"{data:{obj:{API:{apis:{获取所有的人员:{origin:{id:'5d88832a11374caab9288e2a210e4ea1',deleteIf:true,remark:'0',createTime:'2022-03-10 01:10:00',createUser:'admin',updateTime:null,updateUser:'0',moudelType:'202200309002',moudelTypeName:null,interfaceName:'获取所有的人员',interfacePath:'zy_boot/general/getSysUserList',interfaceMethods:'1',tokeIs:true,parameters:[{fieldName:'dictName',fieldValue:'String'}],option_label:'获取所有的人员',option_value:'获取所有的人员'},parameters:[{fieldName:'dictName',fieldValue:'String'}]},获取所有的部门:{origin:{id:'6f40e20fcd474062861fc669f164b64b',deleteIf:true,remark:'0',createTime:'2022-03-10 01:07:54',createUser:'admin',updateTime:'2022-03-16 13:33:42',updateUser:'admin',moudelType:'202200309001',moudelTypeName:null,interfaceName:'获取所有的部门',interfacePath:'zy_boot/general/getSysDepartList',interfaceMethods:'1',tokeIs:true,parameters:[{fieldName:'departName',fieldValue:'String'}],option_label:'获取所有的部门',option_value:'获取所有的部门'},parameters:[{fieldName:'departName',fieldValue:'String'}]}},name:'获取所有的人员'}},type:'API'}}"},computedFun:'',rules:[],server:{field_name:'field__oHoVJ0p5Z0'},rules_json:'[]'},field__plxhRB6asB:{type:'string',ui:{widget:'CusDateTimePicker',label:'日期选择器',widgetConfig:{type:'datetime',valueFormat:'YYYY-MM-DD HH:mm:ss'}},sub_type:'datetime',defaultVal:'2022-03-15 00:00:00',computedFun:'',rules:[],server:{field_name:'field__plxhRB6asB'},rules_json:'[]'},field__gjDsBuTWDN:{type:'string',ui:{widget:'CusTimePicker',label:'时间选择',widgetConfig:{valueFormat:'HH:mm:ss'}},sub_type:'time',defaultVal:'15:59:57',computedFun:'',rules:[],server:{field_name:'field__gjDsBuTWDN'},rules_json:'[]'}},metas:{}},computed:{}};
const formMetas =[[metas]];
let zformCommon = globalThis.createZformCommon({formDef, formComName, formMetas});
let def = {
    template: formTemplate,
    mixins: [
        zformCommon
    ]
}
globalThis[callback]({comName: formComName, def, comMetas: {formName}});
</script>
  */}
}
